#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "../zjson.h"

int main(int argc, char **argv) {
    if (argc != 3) {
        printf("Usage: jsonpath JSONPath-expr json-string\n");
        exit(EXIT_FAILURE);
    }
    jval *json = zJSON_parse(argv[2]);
    assert(json);
    jval *testv = zJSON_exec(json, argv[1]);
    zJSON_prettify(testv, 2);
    printf("\n");
    zJSON_free_jval(json);
    return 0;
}
